package ac.svn.accesscontrol.ui.model;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import javax.swing.ListModel;
import javax.swing.event.ListDataListener;

import ac.svn.accesscontrol.store.SVNTag;

public class TagListModel implements ListModel 
{

	private List<SVNTag> svnTags = null;
	
	public TagListModel()
	{
		this.svnTags = new ArrayList<SVNTag>();
	}
	
	@Override
	public void addListDataListener(ListDataListener arg0) {
		
	}

	@Override
	public Object getElementAt(int index) 
	{
		return svnTags.get(index);
	}

	@Override
	public int getSize() {
		return svnTags.size();
	}

	@Override
	public void removeListDataListener(ListDataListener arg0) {
		// TODO Auto-generated method stub
	}
	
	public void addElement(Object element)
	{
		svnTags.add((SVNTag) element);
		Collections.sort(svnTags);
	}

	
	public void clear()
	{
		svnTags.clear();
	}
}
